<template>
  <!-- 代提货-->
  <div  id="businesses2-3">
    <!--基础表格-->
    <el-table
        border
        :data="table"
        style="width: 100%">
      <el-table-column
          label="订单编号"
      >
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="selectOne(scope.row)">{{scope.row.orderId}}</el-button>
        </template>
      </el-table-column>
      <el-table-column
          prop="userName"
          label="下单用户"
          width="180">
      </el-table-column>
      <el-table-column
          prop="totalNumber"
          label="商品总数量"
          width="180">
      </el-table-column>
      <el-table-column
          prop="totalAmount"
          label="商品总金额"
          width="180">
      </el-table-column>
      <el-table-column
          prop="location"
          label="只提点地址"
          width="180">
      </el-table-column>
      <!--      <el-table-column-->
      <!--          label="操作"-->
      <!--      >-->
      <!--        <template slot-scope="scope">-->
      <!--          <el-button type="primary" size="small" @click="update(scope.row)">发货</el-button>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
    </el-table>
    <!--分页-->
    <el-pagination
        @size-change="page2"
        @current-change="page1"
        :current-page="pageNo"
        :page-sizes="pageList"
        :page-size="pageSize"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
    ></el-pagination>

  </div>
</template>
<script>
export default {
  name: "businesses2-3",
  data() {
    return {
      //账号商户id
      businessesId:this.$root.businessesId,
      //
      table:[],
      //页号
      pageNo:1,
      //页大小
      pageSize:4,
      //总件数
      total:0,
      //分页列表
      pageList:[2,5,10,20],
      vo:{
        //状态
        status:"1",
        // //账号id
        // uid:this.$root.uid,
        //商户查询固定条件
        address:this.$root.businessesId
      }
    }
  },
  methods:{
    page1(val){
      this.pageNo=val
      this.selectPage1()
    },
    // 页大小改变事件
    page2(val){
      this.pageSize=val
      this.selectPage1()
    },
    //查询
    selectPage1(){
      this.$axios.post(`DeskOrder/selectAll/${this.pageNo}/${this.pageSize}`,this.vo).then((r =>{
        console.log("商户订单中心",r.data.rows)
        this.table=r.data.rows;
        this.total=r.data.total;
      }))
    },
    //按钮
    // update(order){
    //   let flag=confirm("确定发货吗")
    //   if(flag){
    //     order.status=1;
    //     console.log("商户订单中心",order)
    //     this.$axios.put(`Order/update`,order).then(r=>{
    //       if(r.data==="ok"){
    //         this.$message({
    //           type:"success",
    //           message:"发货成功"
    //         });
    //         this.selectPage1()
    //       }else {
    //         this.$message({
    //           type:"success",
    //           message:"发货失败"
    //         });
    //       }
    //     })
    //   }
    // },
    //查看单个
    selectOne(order){
      // 路由跳转，跳转到订单确认页面
      this.$router.push({name:`DeskOrderOne`,params:{order:order}})
    },
  },
  created() {
    this.selectPage1()
  }
}
</script>
<style scoped>

</style>